/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.service;

import com.qdu.dao.ActiSingUpDao;
import com.qdu.dao.ActivityDao;
import com.qdu.entity.ActiSingUp;
import com.qdu.entity.Activity;
import java.util.List;

/**
 *为Servlet提供函数信息。
 * @author 19645
 */
public class ActivityService {
    ActivityDao activityDao= new ActivityDao();
    ActiSingUpDao actiSingUpDao= new ActiSingUpDao();
    
    //根据活动编号，获取活动的所有信息
    public Activity findActivityById(String activityId){
        Activity activity=activityDao.GetActiveInfoById(activityId);
        return activity;
    }
    
    //获得所有的活动信息
    public List<Activity> findAllActivity(){
        List<Activity> allActivity=activityDao.getAllActivity();
        return allActivity;
    }
    
    //显示推荐活动列表，在主页面推荐部分
    public List<Activity> findRecommendActivity(){
        List<Activity> recommendAvtivity= activityDao.getRecommendActivity();
        return recommendAvtivity;
    }
    
    //根据关键字获取列表，用于主页面的搜索部分
    public List<Activity> findActivityByKey(String key){
        List<Activity> Avtivity=activityDao.getActivityByKeyword(key);
        return Avtivity;
    }
    
    //我的活动。根据用户id，获取报名的活动
    public List<ActiSingUp> findSingUpUsers(String Uid){
        return actiSingUpDao.getActivByAid(Uid);
    }
    //我要报名
    public int signUp(String Aid,String Uid){
        int row = actiSingUpDao.SignUp(Aid, Uid);
        return row;
    }
    
}
